package com.example.web.controller;

import com.example.common.utils.result.ResultBO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *
 * </p>
 *
 * @author 12071
 * @date 2022/7/29 15:24
 */
@Slf4j
@RestController
public class IndexController {

    @GetMapping("/hello")
    @ResponseBody
    public ResultBO hello(@RequestParam("msg") String msg){
        log.info(">>>>>>>>>> executing in controller");
        return ResultBO.ok(msg);
    }

    @GetMapping("/exception")
    @ResponseBody
    public ResultBO exception(@RequestParam("msg") String msg){
        try{
            int x = 1/0;
        } catch (Exception e){
            throw e;
        }

        log.info(">>>>>>>>>> executing in controller");
        return ResultBO.ok(msg);
    }
}
